# 检查是否传递了两个参数，参数1是服务器地址，参数2是文件目录
if [ "$#" -ne 2 ]; then
    echo "Usage: $0 par1 par2"
    exit 1
fi

echo "upload par1: $1"
echo "upload par2: $2"

scp dist.zip root@$1:$2

echo "scp finish!"

ssh root@$1 > /dev/null 2>&1 << eeooff
cd $2
rm -rf dist
unzip dist.zip
exit
eeooff

echo "upload success"